package com.ruoyi.an.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.an.domain.AnSjLbrItv;
import com.ruoyi.an.service.IAnSjLbrItvService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 人工干预报Controller
 * 
 * @author ruoyi
 * @date 2023-10-24
 */
@RestController
@RequestMapping("/an/itv")
public class AnSjLbrItvController extends BaseController
{
    @Autowired
    private IAnSjLbrItvService anSjLbrItvService;

    /**
     * 查询人工干预报列表
     */
    @PreAuthorize("@ss.hasPermi('an:itv:list')")
    @GetMapping("/list")
    public TableDataInfo list(AnSjLbrItv anSjLbrItv)
    {
        startPage();
        List<AnSjLbrItv> list = anSjLbrItvService.selectAnSjLbrItvList(anSjLbrItv);
        return getDataTable(list);
    }

    /**
     * 导出人工干预报列表
     */
    @PreAuthorize("@ss.hasPermi('an:itv:export')")
    @Log(title = "人工干预报", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AnSjLbrItv anSjLbrItv)
    {
        List<AnSjLbrItv> list = anSjLbrItvService.selectAnSjLbrItvList(anSjLbrItv);
        ExcelUtil<AnSjLbrItv> util = new ExcelUtil<AnSjLbrItv>(AnSjLbrItv.class);
        util.exportExcel(response, list, "人工干预报数据");
    }

    /**
     * 获取人工干预报详细信息
     */
    @PreAuthorize("@ss.hasPermi('an:itv:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(anSjLbrItvService.selectAnSjLbrItvById(id));
    }

    /**
     * 新增人工干预报
     */
    @PreAuthorize("@ss.hasPermi('an:itv:add')")
    @Log(title = "人工干预报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AnSjLbrItv anSjLbrItv)
    {
        return toAjax(anSjLbrItvService.insertAnSjLbrItv(anSjLbrItv));
    }

    /**
     * 修改人工干预报
     */
    @PreAuthorize("@ss.hasPermi('an:itv:edit')")
    @Log(title = "人工干预报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AnSjLbrItv anSjLbrItv)
    {
        return toAjax(anSjLbrItvService.updateAnSjLbrItv(anSjLbrItv));
    }

    /**
     * 删除人工干预报
     */
    @PreAuthorize("@ss.hasPermi('an:itv:remove')")
    @Log(title = "人工干预报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(anSjLbrItvService.deleteAnSjLbrItvByIds(ids));
    }
}
